The logic of self-organization and evolution